<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <title>企业招聘后台系统</title>
    <meta name="keywords" content="企业招聘后台系统">
    <meta name="description" content="企业招聘后台系统">
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/css/animate.css" rel="stylesheet">
    <link href="/css/style.css" rel="stylesheet">
    <link href="/css/login.css" rel="stylesheet">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html"/>
    <![endif]-->
    <script>
        if (window.top !== window.self) {
            window.top.location = window.location;
        }
    </script>
    <style>

    </style>
</head>

<body class="signin">
<div class="signinpanel">
    <div class="row login-bg">
        <div class="title-name">
            <img src="/img/logo.png">
            <div class="text-title">
                <span>鄱阳湖生态科技城</span>
                <span>网络招聘平台</span>
            </div>
        </div>
        <div class="col-sm-6 hello-come">
            <div class="signin-info">
                <div class="logopanel m-b">
                    <h3 class="come">欢迎来到 <img src="/img/come.png"></h3>
                </div>
                <h3>
                    <span>企业招聘后台系统</span>
                </h3>
            </div>
        </div>
        <div class="col-sm-5 login-input">
            <form id="signupForm" autocomplete="off">
                <label style="margin-bottom: 0">
                    <i class="uname" style="top: 0;margin-top: 1px;"></i>
                    <input type="text" name="username" autocomplete="off" id="username" style="margin-bottom: 5px;margin-top: 0;"
                           class="form-control " th:value="${username}"  placeholder="请输入您的用户名"/>
                </label>
                <label style="margin-bottom: 0">
                    <i class="pword" style="top: 0;margin-top: 1px;"></i>
                    <input type="password" name="password" autocomplete="off" id="password" style="margin-top:0;margin-bottom: 5px;"
                       class="form-control" th:value="${password}" placeholder="请输入您的密码"/>
                </label>
                <div class="row">
                    <div class="col-xs-6 pull_left">
                        <div class="form-group">
                            <input class="form-control form-code" type="tel" name="verify" id="verify" placeholder="请输入验证码" maxlength="4">
                        </div>
                    </div>
                    <div class="col-xs-6 pull_left code-img">
                        <a href="javascript:void(0);" rel="external nofollow" title="点击更换验证码">
                            <img style="margin-top: 12px;" id="imgVerify" src="" alt="更换验证码" height="36" width="100%" onclick="getVerify(this);">
                        </a>
                    </div>
                </div>
                <div>
                    <input class="check" type="checkbox" unchecked id="choseRemember">
                    <em class="name">记住用户名</em>
                </div>
                <a id="login" class="btn btn-login btn-block">登录</a>
                <p style="margin-top: 5px;">
                    <a id="register">注册</a>
                    <a id="forgetPws" style="margin-left:60%">忘记密码？</a>
                </p>
            </form>
        </div>
    </div>
    <div class="signup-footer">
        <div>
            九江人才网版权所有  赣B2-20050198号-1  赣公网安备 44030502002121号<br>
            Copyright 1997-2020 cjol.com inc. all rights reserved.
        </div>
    </div>
</div>
<script th:inline="javascript"> var ctx = [[@{
    /}]] ; </script>
<!-- 全局js -->
<script src="/js/jquery.min.js?v=2.1.4" th:src="@{/js/jquery.min.js?v=2.1.4}"></script>
<script src="/js/bootstrap.min.js?v=3.3.6" th:src="@{/js/bootstrap.min.js?v=3.3.6}"></script>

<!-- 自定义js -->
<script src="/js/content.js?v=1.0.0" th:src="@{/js/content.js?v=1.0.0}"></script>

<!-- jQuery Validation plugin javascript-->
<script src="/js/ajax-util.js"></script>
<script src="/js/plugins/validate/jquery.validate.min.js"
         th:src="@{/js/plugins/validate/jquery.validate.min.js}"></script>
<script src="/js/plugins/validate/messages_zh.min.js" th:src="@{/js/plugins/validate/messages_zh.min.js}"></script>
<script src="/js/plugins/layer/layer.min.js" th:src="@{/js/plugins/layer/layer.min.js}"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#login").on('click', function () {
            $("#signupForm").submit();
        });
        validateRule();
        $("body").keydown(keyDownLogon);
        // getVerify($("#imgVerify"));
        $("#imgVerify").click()
        // $("#choseRemember").on('click',function () {
            // validateRule();
            // if(!$("#username").val() || !$("#password").val){
            //     return false;
            // }else{
            //     setCookie("uname", $("#UserAccount").val(), 60);
            //     setCookie("upwd", $("#UserPassword").val(), 60);
            // }
        // });
        $("#register").on('click', function () {
            parent.location.href = '/register';
        });
        $("#forgetPws").on('click', function () {
            var tel=confirm("请联系管理员:188 8888 8888!");
        });
    });

    $.validator.setDefaults({
        submitHandler: function () {
            login();
        }
    });

    function login() {
        $.ajax({
            type: "POST",
            url: ctx + "login",
            data: $('#signupForm').serialize(),
            success: function (r) {
                if (r.code == 0) {
                    var index = layer.load(1, {
                        shade: [0.1, '#fff'] //0.1透明度的白色背景
                    });
                    parent.location.href = '/index';
                } else {
                    layer.msg(r.msg);
                }
            },
        });
    }

    function keyDownLogon() {
        if (event.keyCode == "13") {
            $("#login").trigger('click');
        }
    }
    function validateRule() {
        var icon = "<i class='fa'></i>";
        $("#signupForm").validate({
            rules: {
                username: {
                    required: true
                },
                password: {
                    required: true
                }
            },
            messages: {
                username: {
                    required: icon + "请输入您的用户名",
                },
                password: {
                    required: icon + "请输入您的密码",
                }
            }
        })
    }

    //获取验证码
    function getVerify(obj) {
        obj.src = "/getVerify?" + Math.random();
        console.log(obj)
    }
</script>
</body>
</html>
